﻿using System;
using System.ComponentModel;
using System.Reflection;

namespace Ycjw.PipeLine.Commons
{
    /// <summary>
    /// 基础枚举类
    /// </summary>
    public class EnumHelper
    {
        public static string GetEnumDescription(Enum enumValue)
        {
            string value = enumValue.ToString();
            FieldInfo field = enumValue.GetType().GetField(value);
            object[] objs = field.GetCustomAttributes(typeof(DescriptionAttribute), false);    //获取描述属性
            if (objs == null || objs.Length == 0)    //当描述属性没有时，直接返回名称
                return value;
            DescriptionAttribute descriptionAttribute = (DescriptionAttribute)objs[0];
            return descriptionAttribute.Description;
        }

        /// <summary>
        /// Py执行结果
        /// </summary>
        public enum EPyStatus
        {
            /// <summary>
            /// 参数对象为空
            /// </summary>
            [Description("强制终止")]
            ForceQuit = -1,

            /// <summary>
            /// 正常结束
            /// </summary>
            [Description("正常结束")]
            Normal = 0,

            /// <summary>
            /// Python执行异常
            /// </summary>
            [Description("Python执行异常")]
            RunError = 1,

            /// <summary>
            /// 文件路径不存在
            /// </summary>
            [Description("文件路径不存在")]
            PathError = 2,

            /// <summary>
            /// 获取栅格相交区域异常
            /// </summary>
            [Description("获取栅格相交区域异常")]
            AreaJoinErro = 3,

            /// <summary>
            /// 读取json异常
            /// </summary>
            [Description("读取json异常")]
            JsonError = 5,

            /// <summary>
            /// 参数个数异常
            /// </summary>
            [Description("参数值异常")]
            ArgsCountError = 6,

            /// <summary>
            /// 传入文件类型异常
            /// </summary>
            [Description("传入文件类型异常")]
            FileTypeError = 7,

            /// <summary>
            /// 创建shp异常
            /// </summary>
            [Description("创建shp异常")]
            CreateShpFileError = 8,

            /// <summary>
            /// 空间插值异常
            /// </summary>
            [Description("空间插值异常")]
            SpatialInterpolationError = 9,

            /// <summary>
            /// 栅格运算异常
            /// </summary>
            [Description("栅格运算异常")]
            GridMeasureError = 10,

            /// <summary>
            /// 裁剪栅格异常
            /// </summary>
            [Description("裁剪栅格异常或行政区异常")]
            GridCatError = 11,

            /// <summary>
            /// 重投影异常
            /// </summary>
            [Description("重投影异常")]
            ShadowError = 12,

            /// <summary>
            /// 删除文件异常
            /// </summary>
            [Description("删除文件异常")]
            DeleteFileError = 13,

            /// <summary>
            /// 环境异常
            /// </summary>
            [Description("环境异常")]
            EnvError = 14,

            /// <summary>
            /// 参数对象为空
            /// </summary>
            [Description("参数对象为空")]
            ArgsError = 15,

            /// <summary>
            /// 参数对象为空
            /// </summary>
            [Description("行政区空间参考获取异常")]
            RegionCKError = 66,

            /// <summary>
            /// 参数对象为空
            /// </summary>
            [Description("行政区、评价文件空间参考不一致")]
            SpatialReferenceInconsistent = 67,
        }

        /// <summary>
        /// 控件类型
        /// </summary>
        public enum ECtrlType
        {
            /// <summary>
            /// 下拉控件
            /// </summary>
            ExComboBox = 0,

            /// <summary>
            /// 文本框控件
            /// </summary>
            ExTextBox = 1,

            /// <summary>
            /// 数值控件
            /// </summary>
            NumericEdit = 2,

            /// <summary>
            /// 打开文件控件
            /// </summary>
            OpenDialog = 3,

            /// <summary>
            /// 保存文件控件
            /// </summary>
            SaveDialog = 4,

            /// <summary>
            /// 选择文件控件
            /// </summary>
            ExCheckBox = 5,

            /// <summary>
            ///评价流程描述控件
            /// </summary>
            ExDescriptionContent = 6,

            /// <summary>
            /// 选择文件和下拉控件并行使用
            /// </summary>
            OpenDialogWithComboBox = 7,

            /// <summary>
            ///自定义流程控件
            /// </summary>
            ExCommonCustomer = 8,
        }

        /// <summary>
        /// 结果展示类型
        /// </summary>
        public enum EShowType
        {
            /// <summary>
            /// 仅展示地图
            /// </summary>
            Map = 0,

            /// <summary>
            /// 仅展示统计
            /// </summary>
            Summary = 1,

            /// <summary>
            /// 展示所有信息
            /// </summary>
            All = 2,
        }

        public enum EoptionButton
        {
            /// <summary>
            /// 退出
            /// </summary>
            Eoptbut_Exit = 0,

            /// <summary>
            /// 重载配置
            /// </summary>
            Eoptbut_Reload = 1,

            /// <summary>
            /// 重新配置
            /// </summary>
            Eoptbut_Config = 2,

            /// <summary>
            /// 帮助
            /// </summary>
            Eoptbut_Help = 3,

            /// <summary>
            /// 设置
            /// </summary>
            Eoptbut_Setting = 4,

            /// <summary>
            /// 关于
            /// </summary>
            Eoptbut_About
        }

        public enum EChart
        {
            /// <summary>
            /// 饼图
            /// </summary>
            Pie = 0,

            /// <summary>
            /// 柱状图
            /// </summary>
            Column = 1,
        }

        public enum EBusinessType
        {
            /// <summary>
            /// 路网信息
            /// </summary>
            Reptile_RoadMap = -2,

            /// <summary>
            /// POI
            /// </summary>
            Reptile_POI = -1,

            /// <summary>
            /// 农业土地资源评价
            /// </summary>
            AgriculturalLandResource = 0,

            /// <summary>
            /// 农业水资源评价
            /// </summary>
            AgriculturalWaterResource = 1,

            /// <summary>
            /// 农业气候评价
            /// </summary>
            AgriculturalClimateResource = 2,

            /// <summary>
            /// 农业环境评价
            /// </summary>
            AgriculturalEnvironmentalResource = 3,

            /// <summary>
            /// 农业生态评价
            /// </summary>
            AgriculturalEcology = 4,

            /// <summary>
            /// 农业灾害评价
            /// </summary>
            AgriculturalHazard = 5,

            /// <summary>
            /// 农业集成评价
            /// </summary>
            AgriculturalIntegration = 6,

            /// <summary>
            /// 城镇土地资源评价
            /// </summary>
            TownLandResource = 7,

            /// <summary>
            /// 城镇建设水资源评价
            /// </summary>
            TownWaterResource = 8,

            /// <summary>
            /// 城镇气候评价
            /// </summary>
            TownClimateResource = 9,

            /// <summary>
            /// 城镇大气环境容量
            /// </summary>
            TownAtmosphericEnvironmentalResource = 10,

            /// <summary>
            /// 城镇建设水环境容量评价
            /// </summary>
            TownWaterEnvironmentResource = 11,

            /// <summary>
            /// 城镇建设市县层面区位优势度评价
            /// </summary>
            TownCountyLocationAdvantageResource = 12,

            /// <summary>
            /// 城镇地质灾害评价
            /// </summary>
            TownGeologicalHazard = 13,

            /// <summary>
            /// 城镇风暴潮灾害评价
            /// </summary>
            TownStormTide = 14,

            /// <summary>
            /// 城镇集成评价
            /// </summary>
            TownIntegration = 15,

            /// <summary>
            /// 物种层面生物多样性维护功能开发
            /// </summary>
            EcologySpeciesLevelBiodiversity = 16,

            /// <summary>
            /// 生态系统层面生物多样性维护功能评价
            /// </summary>
            EcologyEcosystemLevelBiodiversity = 17,

            /// <summary>
            /// 生态水土保持功能评价
            /// </summary>
            EcologyWaterLandConservation = 18,

            /// <summary>
            /// 水源涵养
            /// </summary>
            EcologyWaterConservation = 19,

            /// <summary>
            /// 防风固沙
            /// </summary>
            EcologyWindAndSandFixation = 20,

            /// <summary>
            /// 海岸防护
            /// </summary>
            EcologyCoastalProtection = 21,

            /// <summary>
            /// 生态系统服务功能重要性集成评价
            /// </summary>
            EcologyEcosystemServiceIntegrated = 22,

            /// <summary>
            /// 水土流失敏感性
            /// </summary>
            EcologySoilErosionSensitivity = 23,

            /// <summary>
            /// 沙化敏感性
            /// </summary>
            EcologySandificationSensitivity = 24,

            /// <summary>
            /// 石漠化敏感性
            /// </summary>
            EcologyDesertification = 25,

            /// <summary>
            /// 海岸侵蚀敏感性
            /// </summary>
            EcologyCoastErosion = 26,

            /// <summary>
            /// 生态敏感性集成评价
            /// </summary>
            EcologyEcologicalSensitivityIntegrated = 27,

            /// <summary>
            /// 初判生态保护重要性评价
            /// </summary>
            EcologyIntegrated = 28,

            /// <summary>
            /// 修正生态保护重要性评价
            /// </summary>
            EcologyIntegratedCorrect = 29,

            /// <summary>
            /// 农业土地资源承载力评价
            /// </summary>
            AgriculturalLandCapacity = 30,

            /// <summary>
            /// 水资源约束下农业生产承载规模评价
            /// </summary>
            AgriculturalWaterCapacity = 31,

            /// <summary>
            /// 城镇土地资源承载力评价
            /// </summary>
            TownLandCapacity = 32,

            /// <summary>
            /// 水资源约束下城镇建设承载规模评价
            /// </summary>
            TownWaterCapacity = 33,

            /// <summary>
            /// 黄土漏斗区评价
            /// </summary>
            LoessAreaAnalyze = 34,

            /// <summary>
            /// 文化遗址区评价
            /// </summary>
            CulturalHeritageAreaAnalyze = 35,

            /// <summary>
            /// 农业采空区评价
            /// </summary>
            AgriculturalMinedOutAreaAnalyze = 36,

            /// <summary>
            /// 自定义模型评价
            /// </summary>
            CommonCustomer = 37,

            /// <summary>
            /// 农业种植业生产适宜性评价
            /// </summary>
            CultivationProduction = 38,

            /// <summary>
            /// 牧区畜牧业生产适宜性评价
            /// </summary>
            PastureHusbandry = 39,

            /// <summary>
            /// 农区畜牧业生产适宜性评价
            /// </summary>
            AgriHusbandry = 40,

            /// <summary>
            /// 渔业捕捞生产适宜性评价
            /// </summary>
            Fishing = 41,

            /// <summary>
            /// 渔业养殖生产适宜性评价
            /// </summary>
            FisheryCulture = 42,

            /// <summary>
            /// 农业种植业生产不适宜性评价
            /// </summary>
            CropProductionUnfavorable = 43,

            /// <summary>
            /// 农业生产适宜性集成评价
            /// </summary>
            AgriculturalSuitability = 44,

            /// <summary>
            /// 集成评价结果修正
            /// </summary>
            IntegrationResultCorrection = 45,
        }
    }
}